/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.com1263.dao;

/**
 *
 * @author Luiz Cardoso
 */
import java.util.Collection;

import javax.persistence.Query;

import br.edu.com1263.model.Curso;

public class CursoDAOImpl extends AbstractDAO implements CursoDAO {
    public CursoDAOImpl() {
    }

    public void salvar(Curso curso) {
        manager.persist(curso);
    }
    
    public void alterar(Curso curso) {
		manager.merge(curso);
	}
    
    public void remover(Curso curso) {
		manager.remove(curso);
	}

	@Override
	public Curso consultar(Long id) {
		return manager.find(Curso.class, id);
	}

	@Override
	public Collection<Curso> consultarTodos() {
		Query query = manager.createQuery("SELECT c FROM Curso c");
		return query.getResultList();
	}
}
